package com.tfy.liquor.controller;

import com.tfy.liquor.service.RolloverRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;

/**
 * 礼包转购物券
 */
@Controller
public class RolloverRecordsController {
    @Autowired
    private RolloverRecordsService rolloverRecordsService;

//    @RequestMapping("/rolloverRecords")
//    public String fileUpload(Model model, Integer pageNum, Integer pageSize, String value, String userId, String cap, String date) {
//        if (null == pageNum || pageNum < 1) {
//            pageNum = 1;
//        }
//        // 查询数据并返回前端
//        model.addAttribute("value", value);
//        model.addAttribute("userId", userId);
//        model.addAttribute("cap", cap);
//        model.addAttribute("date", date);
//        model.addAttribute("lastPage", pageNum - 1);
//        model.addAttribute("nextPage", pageNum + 1);
//        rolloverRecordsService.getInfo(model, pageNum, pageSize, value, userId, cap, date);
//        return "rolloverRecords";
//    }

    /**
     * 导出文件
     */
    @RequestMapping("getRolloverRecordsExcel")
    public void getExcel(HttpServletResponse response, String value, String userId, String cap, String date) {
//        System.err.println(value);
//        System.err.println(userId);
//        System.err.println(cap);
//        System.err.println(date);
        rolloverRecordsService.ExportRolloverRecordsExcel(response, value, userId, cap, date);
    }

}
